# Distributed under the terms of the Modified BSD License.

# This Dockerfile is for 
# The buid from the base of scipy-notebook, based on python 3.11

ARG BASE_CONTAINER=tensorflow/tensorflow:2.14.0-gpu-jupyter
FROM $BASE_CONTAINER

LABEL maintainer="Wanke Pan <panwanke2023@gmail.com>"

USER root

RUN apt-get update -y && \
  # numactl for TensorFlow NUMA node
  apt-get install numactl -y && \
  rm -rf /var/lib/apt/lists/*

ENV TF_ENABLE_ONEDNN_OPTS=0
## numactl for TensorFlow NUMA node. check through: numactl --hardware
ENV TF_CPP_MIN_VLOG_LEVEL=1
ENV TF_CPP_VMODULE=numa_api=1

USER $NB_UID
RUN pip install --upgrade pip

# RUN pip install git+https://gitee.com/epool/BayesFlow.git -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install git+https://github.com/stefanradev93/bayesflow -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install pip install --no-cache-dir numba -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install --no-cache-dir git+https://github.com/tensorflow/probability -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install --no-cache-dir git+https://github.com/mwaskom/seaborn -i https://pypi.tuna.tsinghua.edu.cn/simple

RUN pip install --no-cache-dir git+https://gitee.com/epool/ssm-simulators.git -i https://pypi.tuna.tsinghua.edu.cn/simple

# Import matplotlib the first time to build the font cache.
ENV XDG_CACHE_HOME="/home/${NB_USER}/.cache/"
RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot"

USER $NB_UID
WORKDIR $HOME

# Copy example data and scripts to the example folder
RUN mkdir /tf/tutorial

COPY /tutorial/Intro_Amortized_Posterior_Estimation.ipynb /tf/tutorial
COPY /tutorial/NDDM_test.ipynb /tf/tutorial
